---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/jesse/Dropbox/Ohio-HallResearch/Code/replication/table_a1.log
  log type:  text
 opened on:  11 Jun 2020, 12:28:05

. 
. use "$path/foreclosures_analysis.dta", clear

. 
. 
. keep if year == 2004 | year == 2008
(5,429 observations deleted)

. keep if state == "CA"
(3,997 observations deleted)

. bys fips: gen n = _N

. keep if n == 2
(0 observations deleted)

. 
. // merge on county foreclosure change variable for 2008
. merge 1:1 fips year using "$path/change_merge"

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,018
        from master                        58  (_merge==1)
        from using                      1,960  (_merge==2)

    matched                                58  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(1,960 observations deleted)

. sort fips year

. by fips: gen vote_change = pres_vs - pres_vs[_n-1]
(58 missing values generated)

. 
. drop foreclosure_rate

. rename fore_change foreclosure_rate

. 
. egen p01 = pctile(foreclosure_rate), p(50)

. egen p99 = pctile(foreclosure_rate), p(99)

. replace foreclosure_rate = (foreclosure_rate-p01)/(p99-p01)
(58 real changes made)

. 
. 
. reg vote_change foreclosure_rate, r

Linear regression                               Number of obs     =         58
                                                F(1, 56)          =      61.69
                                                Prob > F          =     0.0000
                                                R-squared         =     0.4719
                                                Root MSE          =     1.4609

----------------------------------------------------------------------------------
                 |               Robust
     vote_change |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
foreclosure_rate |   4.193794   .5339376     7.85   0.000     3.124189      5.2634
           _cons |    6.56286   .2123493    30.91   0.000     6.137473    6.988247
----------------------------------------------------------------------------------

. local b1 = _b[foreclosure_rate]

. local se1 = _se[foreclosure_rate]

. local n1 = e(N)

. local nclust1 = e(N_clust)

. 
. reg vote_change foreclosure_rate [aw=pop_y], r
(sum of wgt is 36,145,239)

Linear regression                               Number of obs     =         58
                                                F(1, 56)          =      30.69
                                                Prob > F          =     0.0000
                                                R-squared         =     0.3999
                                                Root MSE          =     1.4389

----------------------------------------------------------------------------------
                 |               Robust
     vote_change |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
foreclosure_rate |   3.571342   .6446196     5.54   0.000     2.280014     4.86267
           _cons |   6.993332   .3358072    20.83   0.000     6.320629    7.666035
----------------------------------------------------------------------------------

. local b2 = _b[foreclosure_rate]

. local se2 = _se[foreclosure_rate]

. local n2 = e(N)

. local nclust2 = e(N_clust)

. 
. 
. use "$path/foreclosures_analysis.dta", clear

. 
. keep if year == 2004 | year == 2008
(5,429 observations deleted)

. keep if state == "NV" | state == "MI" | state == "AZ" | state == "FL" | state == "RI"
(3,835 observations deleted)

. bys fips: gen n = _N

. keep if n == 2
(24 observations deleted)

. 
. // merge on county foreclosure change variable for 2008
. merge 1:1 fips year using "$path/change_merge"

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,018
        from master                       127  (_merge==1)
        from using                      1,891  (_merge==2)

    matched                               127  (_merge==3)
    -----------------------------------------

. drop if _merge == 2
(1,891 observations deleted)

. sort fips year

. by fips: gen vote_change = pres_vs - pres_vs[_n-1]
(127 missing values generated)

. 
. drop foreclosure_rate

. rename fore_change foreclosure_rate

. 
. egen p01 = pctile(foreclosure_rate), p(50)

. egen p99 = pctile(foreclosure_rate), p(99)

. replace foreclosure_rate = (foreclosure_rate-p01)/(p99-p01)
(127 real changes made)

. 
. 
. areg vote_change foreclosure_rate, a(state) r

Linear regression, absorbing indicators         Number of obs     =        127
Absorbed variable: state                        No. of categories =          5
                                                F(   1,    121)   =       5.17
                                                Prob > F          =     0.0247
                                                R-squared         =     0.4079
                                                Adj R-squared     =     0.3834
                                                Root MSE          =     3.2748

----------------------------------------------------------------------------------
                 |               Robust
     vote_change |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
foreclosure_rate |    2.49778   1.098364     2.27   0.025     .3232795    4.672281
           _cons |   2.796524    .304159     9.19   0.000     2.194361    3.398687
----------------------------------------------------------------------------------

. local b3 = _b[foreclosure_rate]

. local se3 = _se[foreclosure_rate]

. local n3 = e(N)

. local nclust3 = e(N_clust)

. 
. areg vote_change foreclosure_rate [aw=pop_y], a(state) r
(sum of wgt is 32,790,904)

Linear regression, absorbing indicators         Number of obs     =        127
Absorbed variable: state                        No. of categories =          5
                                                F(   1,    121)   =       0.07
                                                Prob > F          =     0.7980
                                                R-squared         =     0.4078
                                                Adj R-squared     =     0.3834
                                                Root MSE          =     2.3236

----------------------------------------------------------------------------------
                 |               Robust
     vote_change |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------+----------------------------------------------------------------
foreclosure_rate |   .2259941   .8810462     0.26   0.798    -1.518269    1.970257
           _cons |   4.202717   .4077272    10.31   0.000     3.395514    5.009921
----------------------------------------------------------------------------------

. local b4 = _b[foreclosure_rate]

. local se4 = _se[foreclosure_rate]

. local n4 = e(N)

. local nclust4 = e(N_clust)

. 
. log close
      name:  <unnamed>
       log:  /Users/jesse/Dropbox/Ohio-HallResearch/Code/replication/table_a1.log
  log type:  text
 closed on:  11 Jun 2020, 12:28:05
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
